using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace xingzhimeng
{
  ///<summary>
  ///
  ///</summary>
public class BlackBool : MonoBehaviour
{
        private Pigs[] pig;

        private void Start()
        {
           pig = FindObjectsOfType<Pigs>();
           Pigs[]  pp=pig.Finds<Pigs>(s => Vector2.Distance(s.transform.position, transform.position) < 1);
            if (pp == null) return;
            for(int i=0;i<pp.Length;i++)
            {
                int harm = 0;
                if (Vector3.Distance(transform.position, pp[i].transform.position) < 0.9)
                {
                    harm = 20;
                }
                else if (Vector3.Distance(transform.position, pp[i].transform.position) < 1.2)
                    harm = 12;
                else
                {
                    harm = 8;
                }
                pp[i].HpJian(harm);
            }
            
        }


    }

}

